﻿#region License
/* ---------------------------------------------------------------- *
 *
 * This file is part of the Xcoordination Application Space
 * ("XcoAppSpace") http://www.xcoordination.com
 *
 * Copyright (C) 2009 Xcoordination http://www.xcoordination.com
 *
 * XcoAppSpace is free software; you can redistribute it and/or
 * modify it under the terms of version 2 of the GNU General
 * Public License as published by the Free Software Foundation.
 *
 * XcoAppSpace is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see http://www.gnu.org/licenses/
 * or write to the Free Software Foundation, Inc., 51 Franklin
 * Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 * ---------------------------------------------------------------- */
#endregion

using System;
using System.ServiceModel.Description;
using System.ServiceModel.Channels;
using System.ServiceModel;
using System.Text;
namespace XcoAppSpaces.Transport.WCF
{
    /// <summary>
    /// Helper for different WCF Bindings
    /// </summary>
    public interface IBindingsHelper
    {
        /// <summary>
        /// Creates standard Uri for a net.tcp WCF service
        /// </summary>
        /// <param name="port"></param>
        /// <returns></returns>
        Uri GenerateStandardNetTcp(int port);

        
        /// <summary>
        /// Converts a given address with the default binding to a service WCF address
        /// </summary>
        /// <param name="address"></param>
        /// <returns>WCF service address</returns>
        string Convert(string address);
        
        
        /// <summary>
        /// Converts a given address and binding to a service WCF address
        /// </summary>
        /// <param name="bindingType">The binding that should be used</param>
        /// <param name="address">The address that should be used</param>
        /// <returns>WCF service address</returns>
        Uri Convert(Binding bindingType, string address);
        
        /// <summary>
        /// The address part of the server (binding-specific)
        /// </summary>
        /// <param name="addr">WCF service address</param>
        /// <returns>The address part of the server</returns>
        string ServerAddr(Uri addr);
        
        /// <summary>
        /// Port of the server
        /// </summary>
        /// <param name="addr">WCF service address</param>
        /// <returns>Port of the server</returns>
        int Port(Uri addr);
    }
}